<?php
set_time_limit(0) ;
if(session_start()) ;
require "lander.php";
require "dbconf.php";require "dbconf.php";

echo "Started";


// DB CONNECTION
$mysqli = new mysqli($dbhost, $dbuser, $dbpassword, $dbname);

// IT INSTANTIATES THE DEEPERABYSS
$da = new deeperAbyss($mysqli);

//$mysqli->query("truncate table files");
 
 
		//LOG THE END OF TASK
		if (! ($dtree = $da->scan_directory_recursively($_SESSION['drive_left'].":".$_SESSION['path_left'],false))){
			$da->mysqli->query("insert into operation_status values (NULL, '" . $da->current_operation . "', 'END', 'OK',  -1, now());");			 
		}
		else {
			$da->mysqli->query("insert into operation_status values (NULL, '" . $da->current_operation . "', 'END', 'BAD',  -1, now());");			 
		}

		

$debug=true;
if ($debug)  "<pre>";
if ($debug)  print_r($dtree);
if ($debug)  "</pre>";
$debug=false;
echo "<li><b>END</b>";
while ($var = each($_SESSION)) {
printf ("Key <b>%s</b> has the value of: <b>%s</b><br>", $var['key'], $var['value']);
} 

?>